Method and apparatus for processing video signal

ABSTRACT

A method for decoding a video according to the present invention may comprise: determining merge target candidate blocks of a current coding block, specifying at least one among the merge target candidate blocks, and generating a merged block by merging the specified merge target candidate block and the current coding block.

TECHNICAL FIELD

The present invention relates to a method and an apparatus forprocessing video signal.

BACKGROUND ART

Recently, demands for high-resolution and high-quality images such ashigh definition (HD) images and ultra-high definition (UHD) images haveincreased in various application fields. However, higher resolution andquality image data has increasing amounts of data in comparison withconventional image data. Therefore, when transmitting image data byusing a medium such as conventional wired and wireless broadbandnetworks, or when storing image data by using a conventional storagemedium, costs of transmitting and storing increase. In order to solvethese problems occurring with an increase in resolution and quality ofimage data, high-efficiency image encoding/decoding techniques may beutilized.

Image compression technology includes various techniques, including: aninter-prediction technique of predicting a pixel value included in acurrent picture from a previous or subsequent picture of the currentpicture; an intra-prediction technique of predicting a pixel valueincluded in a current picture by using pixel information in the currentpicture; an entropy encoding technique of assigning a short code to avalue with a high appearance frequency and assigning a long code to avalue with a low appearance frequency; etc. Image data may beeffectively compressed by using such image compression technology, andmay be transmitted or stored.

In the meantime, with demands for high-resolution images, demands forstereographic image content, which is a new image service, have alsoincreased. A video compression technique for effectively providingstereographic image content with high resolution and ultra-highresolution is being discussed.

DISCLOSURE Technical Problem

An object of the present invention is to provide a method and anapparatus for efficiently splitting/merging an encoding/decoding targetblock in encoding/decoding a video signal.

An object of the present invention is to provide a method and anapparatus for merging two blocks in which a division is completed andperforming a prediction or a transform based on the merged block inencoding/decoding a video signal.

An object of the present invention is to provide a method and apparatusfor performing a transform by dividing or converting a block ofnon-square shape into a block of square shape in encoding/decoding avideo signal.

The technical objects to be achieved by the present invention are notlimited to the above-mentioned technical problems. And, other technicalproblems that are not mentioned will be apparently understood to thoseskilled in the art from the following description.

Technical Solution

A method and an apparatus for decoding a video signal according to thepresent invention may determine merge target candidate blocks of acurrent coding block, specify at least one among the merge targetcandidate blocks, and generate a merged block by merging the specifiedmerge target candidate block and the current coding block.

A method and an apparatus for encoding a video signal according to thepresent invention may determine merge target candidate blocks of acurrent coding block, specify at least one among the merge targetcandidate blocks, and generate a merged block by merging the specifiedmerge target candidate block and the current coding block.

In the method and the apparatus for encoding/decoding a video signalaccording to the present invention, a plurality of coding blocksincluded in the merged block may have same motion information or have asame intra prediction mode.

In the method and the apparatus for encoding/decoding a video signalaccording to the present invention, a plurality of coding blocksincluded in the merged block may have a same transform type.

In the method and the apparatus for encoding/decoding a video signalaccording to the present invention, the transform type may comprise atleast one of a transform scheme or a transform mode.

In the method and the apparatus for encoding/decoding a video signalaccording to the present invention, the merge target candidate blocksmay comprise at least one of neighboring blocks adjacent to the currentcoding block.

In the method and the apparatus for encoding/decoding a video signalaccording to the present invention, whether a neighboring block isavailable to be used as the merge target candidate block or not may bedetermined based on at least one of a height, a width or a size of thecurrent coding block and the neighboring coding block.

In the method and the apparatus for encoding/decoding a video signalaccording to the present invention, merging the current coding block andthe merge target candidate block may be allowed only when a size or ashape of the current coding block satisfies a pre-defined condition.

The features briefly summarized above for the present invention are onlyillustrative aspects of the detailed description of the invention thatfollows, but do not limit the scope of the invention.

Advantageous Effects

According to the present invention, encoding/decoding efficiency can beimproved by efficiently splitting/merging an encoding/decoding targetblock.

According to the present invention, encoding/decoding efficiency can beimproved by merging two blocks in which a division is completed andperforming a prediction or a transform based on the merged block.

According to the present invention, encoding/decoding efficiency can beimproved by performing a transform after dividing or converting a blockof a non-square shape into a block of square shape.

The effects obtainable by the present invention are not limited to theabove-mentioned effects, and other effects not mentioned can be clearlyunderstood by those skilled in the art from the description below.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating a device for encoding a videoaccording to an embodiment of the present invention.

FIG. 2 is a block diagram illustrating a device for decoding a videoaccording to an embodiment of the present invention.

FIG. 3 is a diagram illustrating an example of hierarchicallypartitioning a coding block based on a tree structure according to anembodiment of the present invention.

FIG. 4 is a diagram illustrating a partition type in which binarytree-based partitioning is allowed according to an embodiment of thepresent invention.

FIGS. 5A and 5B are diagrams illustrating an example in which only abinary tree-based partition of a pre-determined type is allowedaccording to an embodiment of the present invention.

FIG. 6 is a diagram for explaining an example in which informationrelated to the allowable number of binary tree partitioning isencoded/decoded, according to an embodiment to which the presentinvention is applied.

FIG. 7 illustrates a partition type of a coding block based onasymmetric binary tree partitioning.

FIG. 8 shows an example in which a coding block is divided into aplurality of coding blocks using QTBT and asymmetric binary treepartitioning.

FIG. 9 is a diagram illustrating partition types which can be applied toa coding block.

FIG. 10 is a diagram illustrating a partition mode that can be appliedto a coding block when the coding block is encoded by inter prediction.

FIG. 11 is a diagram illustrating an example in which a merge predictionblock is generated.

FIG. 12 is a diagram illustrating an example in which a merge predictionblock is generated by merging a plurality of coding blocks.

FIGS. 13 and 14 are diagrams illustrating reference samples of a mergeprediction block.

FIG. 15 is a flowchart illustrating a block merging method according toan embodiment of the present invention.

FIG. 16 is a flowchart illustrating processes of obtaining a residualsample according to an embodiment to which the present invention isapplied.

FIG. 17 is a diagram illustrating a transform coefficient level map.

FIG. 18 is a diagram for explaining an aspect in which a transformcoefficient coded indicator is decoded based on a predetermined unit.

FIG. 19 is a diagram illustrating a decoding order of transformcoefficients according to each scanning order.

FIG. 20 is a diagram illustrating a scanning order between sub-blocksaccording to a scanning order of a current block.

FIG. 21 is a diagram illustrating a scanning order of a transformcoefficient basic block according to a shape of a current block.

FIG. 22 is a diagram illustrating an example of dividing a current blockof a non-square shape into sub-blocks of a square shape.

FIGS. 23 to 26 are diagrams illustrating an example of converting ablock of a non-square shape into a block of a square-shape.

MODE FOR INVENTION

A variety of modifications may be made to the present invention andthere are various embodiments of the present invention, examples ofwhich will now be provided with reference to drawings and described indetail. However, the present invention is not limited thereto, and theexemplary embodiments can be construed as including all modifications,equivalents, or substitutes in a technical concept and a technical scopeof the present invention. The similar reference numerals refer to thesimilar element in described the drawings.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component without departing from the scope ofthe present invention, and the ‘second’ component may also be similarlynamed the ‘first’ component. The term ‘and/or’ includes a combination ofa plurality of items or any one of a plurality of terms.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. In contrast,it should be understood that when an element is referred to as being“directly coupled” or “directly connected” to another element, there areno intervening elements present.

The terms used in the present specification are merely used to describeparticular embodiments, and are not intended to limit the presentinvention. An expression used in the singular encompasses the expressionof the plural, unless it has a clearly different meaning in the context.In the present specification, it is to be understood that terms such as“including”, “having”, etc. are intended to indicate the existence ofthe features, numbers, steps, actions, elements, parts, or combinationsthereof disclosed in the specification, and are not intended to precludethe possibility that one or more other features, numbers, steps,actions, elements, parts, or combinations thereof may exist or may beadded.

Hereinafter, preferred embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.Hereinafter, the same constituent elements in the drawings are denotedby the same reference numerals, and a repeated description of the sameelements will be omitted.

FIG. 1 is a block diagram illustrating a device for encoding a videoaccording to an embodiment of the present invention.

Referring to FIG. 1, the device 100 for encoding a video may include: apicture partitioning module 110, prediction modules 120 and 125, atransform module 130, a quantization module 135, a rearrangement module160, an entropy encoding module 165, an inverse quantization module 140,an inverse transform module 145, a filter module 150, and a memory 155.

The constitutional parts shown in FIG. 1 are independently shown so asto represent characteristic functions different from each other in thedevice for encoding a video. Thus, it does not mean that eachconstitutional part is constituted in a constitutional unit of separatedhardware or software. In other words, each constitutional part includeseach of enumerated constitutional parts for convenience. Thus, at leasttwo constitutional parts of each constitutional part may be combined toform one constitutional part or one constitutional part may be dividedinto a plurality of constitutional parts to perform each function. Theembodiment where each constitutional part is combined and the embodimentwhere one constitutional part is divided are also included in the scopeof the present invention, if not departing from the essence of thepresent invention.

Also, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

The picture partitioning module 110 may partition an input picture intoone or more processing units. Here, the processing unit may be aprediction unit (PU), a transform unit (TU), or a coding unit (CU). Thepicture partitioning module 110 may partition one picture intocombinations of multiple coding units, prediction units, and transformunits, and may encode a picture by selecting one combination of codingunits, prediction units, and transform units with a predeterminedcriterion (e.g., cost function).

For example, one picture may be partitioned into multiple coding units.A recursive tree structure, such as a quad tree structure, may be usedto partition a picture into coding units. A coding unit which ispartitioned into other coding units with one picture or a largest codingunit as a root may be partitioned with child nodes corresponding to thenumber of partitioned coding units. A coding unit which is no longerpartitioned by a predetermined limitation serves as a leaf node. Thatis, when it is assumed that only square partitioning is possible for onecoding unit, one coding unit may be partitioned into four other codingunits at most.

Hereinafter, in the embodiment of the present invention, the coding unitmay mean a unit performing encoding, or a unit performing decoding.

A prediction unit may be one of partitions partitioned into a square ora rectangular shape having the same size in a single coding unit, or aprediction unit may be one of partitions partitioned so as to have adifferent shape/size in a single coding unit.

When a prediction unit subjected to intra prediction is generated basedon a coding unit and the coding unit is not the smallest coding unit,intra prediction may be performed without partitioning the coding unitinto multiple prediction units N×N.

The prediction modules 120 and 125 may include an inter predictionmodule 120 performing inter prediction and an intra prediction module125 performing intra prediction. Whether to perform inter prediction orintra prediction for the prediction unit may be determined, and detailedinformation (e.g., an intra prediction mode, a motion vector, areference picture, etc.) according to each prediction method may bedetermined. Here, the processing unit subjected to prediction may bedifferent from the processing unit for which the prediction method anddetailed content is determined. For example, the prediction method, theprediction mode, etc. may be determined by the prediction unit, andprediction may be performed by the transform unit. A residual value(residual block) between the generated prediction block and an originalblock may be input to the transform module 130. Also, prediction modeinformation, motion vector information, etc. used for prediction may beencoded with the residual value by the entropy encoding module 165 andmay be transmitted to a device for decoding a video. When a particularencoding mode is used, it is possible to transmit to a device fordecoding video by encoding the original block as it is withoutgenerating the prediction block through the prediction modules 120 and125.

The inter prediction module 120 may predict the prediction unit based oninformation of at least one of a previous picture or a subsequentpicture of the current picture, or may predict the prediction unit basedon information of some encoded regions in the current picture, in somecases. The inter prediction module 120 may include a reference pictureinterpolation module, a motion prediction module, and a motioncompensation module.

The reference picture interpolation module may receive reference pictureinformation from the memory 155 and may generate pixel information of aninteger pixel or less then the integer pixel from the reference picture.In the case of luma pixels, an 8-tap DCT-based interpolation filterhaving different filter coefficients may be used to generate pixelinformation of an integer pixel or less than an integer pixel in unitsof a ¼ pixel. In the case of chroma signals, a 4-tap DCT-basedinterpolation filter having different filter coefficient may be used togenerate pixel information of an integer pixel or less than an integerpixel in units of a ⅛ pixel.

The motion prediction module may perform motion prediction based on thereference picture interpolated by the reference picture interpolationmodule. As methods for calculating a motion vector, various methods,such as a full search-based block matching algorithm (FBMA), a threestep search (TSS), a new three-step search algorithm (NTS), etc., may beused. The motion vector may have a motion vector value in units of a ½pixel or a ¼ pixel based on an interpolated pixel. The motion predictionmodule may predict a current prediction unit by changing the motionprediction method. As motion prediction methods, various methods, suchas a skip method, a merge method, an AMVP (Advanced Motion VectorPrediction) method, an intra block copy method, etc., may be used.

The intra prediction module 125 may generate a prediction unit based onreference pixel information neighboring to a current block which ispixel information in the current picture. When the neighboring block ofthe current prediction unit is a block subjected to inter prediction andthus a reference pixel is a pixel subjected to inter prediction, thereference pixel included in the block subjected to inter prediction maybe replaced with reference pixel information of a neighboring blocksubjected to intra prediction. That is, when a reference pixel is notavailable, at least one reference pixel of available reference pixelsmay be used instead of unavailable reference pixel information.

Prediction modes in intra prediction may include a directionalprediction mode using reference pixel information depending on aprediction direction and a non-directional prediction mode not usingdirectional information in performing prediction. A mode for predictingluma information may be different from a mode for predicting chromainformation, and in order to predict the chroma information, intraprediction mode information used to predict luma information orpredicted luma signal information may be utilized.

In performing intra prediction, when the size of the prediction unit isthe same as the size of the transform unit, intra prediction may beperformed on the prediction unit based on pixels positioned at the left,the top left, and the top of the prediction unit. However, in performingintra prediction, when the size of the prediction unit is different fromthe size of the transform unit, intra prediction may be performed usinga reference pixel based on the transform unit. Also, intra predictionusing N×N partitioning may be used for only the smallest coding unit.

In the intra prediction method, a prediction block may be generatedafter applying an AIS (Adaptive Intra Smoothing) filter to a referencepixel depending on the prediction modes. The type of the AIS filterapplied to the reference pixel may vary. In order to perform the intraprediction method, an intra prediction mode of the current predictionunit may be predicted from the intra prediction mode of the predictionunit neighboring to the current prediction unit. In prediction of theprediction mode of the current prediction unit by using mode informationpredicted from the neighboring prediction unit, when the intraprediction mode of the current prediction unit is the same as the intraprediction mode of the neighboring prediction unit, informationindicating that the prediction modes of the current prediction unit andthe neighboring prediction unit are equal to each other may betransmitted using predetermined flag information. When the predictionmode of the current prediction unit is different from the predictionmode of the neighboring prediction unit, entropy encoding may beperformed to encode prediction mode information of the current block.

Also, a residual block including information on a residual value whichis a different between the prediction unit subjected to prediction andthe original block of the prediction unit may be generated based onprediction units generated by the prediction modules 120 and 125. Thegenerated residual block may be input to the transform module 130.

The transform module 130 may transform the residual block including theinformation on the residual value between the original block and theprediction unit generated by the prediction modules 120 and 125 by usinga transform method, such as discrete cosine transform (DCT), discretesine transform (DST), and KLT. Whether to apply DCT, DST, or KLT inorder to transform the residual block may be determined based on intraprediction mode information of the prediction unit used to generate theresidual block.

The quantization module 135 may quantize values transformed to afrequency domain by the transform module 130. Quantization coefficientsmay vary depending on the block or importance of a picture. The valuescalculated by the quantization module 135 may be provided to the inversequantization module 140 and the rearrangement module 160.

The rearrangement module 160 may rearrange coefficients of quantizedresidual values.

The rearrangement module 160 may change a coefficient in the form of atwo-dimensional block into a coefficient in the form of aone-dimensional vector through a coefficient scanning method. Forexample, the rearrangement module 160 may scan from a DC coefficient toa coefficient in a high frequency domain using a zigzag scanning methodso as to change the coefficients to be in the form of one-dimensionalvectors. Depending on the size of the transform unit and the intraprediction mode, vertical direction scanning where coefficients in theform of two-dimensional blocks are scanned in the column direction orhorizontal direction scanning where coefficients in the form oftwo-dimensional blocks are scanned in the row direction may be usedinstead of zigzag scanning. That is, which scanning method among zigzagscanning, vertical direction scanning, and horizontal direction scanningis used may be determined depending on the size of the transform unitand the intra prediction mode.

The entropy encoding module 165 may perform entropy encoding based onthe values calculated by the rearrangement module 160. Entropy encodingmay use various encoding methods, for example, exponential Golombcoding, context-adaptive variable length coding (CAVLC), andcontext-adaptive binary arithmetic coding (CABAC).

The entropy encoding module 165 may encode a variety of information,such as residual value coefficient information and block typeinformation of the coding unit, prediction mode information, partitionunit information, prediction unit information, transform unitinformation, motion vector information, reference frame information,block interpolation information, filtering information, etc. from therearrangement module 160 and the prediction modules 120 and 125.

The entropy encoding module 165 may entropy encode the coefficients ofthe coding unit input from the rearrangement module 160.

The inverse quantization module 140 may inversely quantize the valuesquantized by the quantization module 135 and the inverse transformmodule 145 may inversely transform the values transformed by thetransform module 130. The residual value generated by the inversequantization module 140 and the inverse transform module 145 may becombined with the prediction unit predicted by a motion estimationmodule, a motion compensation module, and the intra prediction module ofthe prediction modules 120 and 125 such that a reconstructed block canbe generated.

The filter module 150 may include at least one of a deblocking filter,an offset correction unit, and an adaptive loop filter (ALF).

The deblocking filter may remove block distortion that occurs due toboundaries between the blocks in the reconstructed picture. In order todetermine whether to perform deblocking, the pixels included in severalrows or columns in the block may be a basis of determining whether toapply the deblocking filter to the current block. When the deblockingfilter is applied to the block, a strong filter or a weak filter may beapplied depending on required deblocking filtering strength. Also, inapplying the deblocking filter, horizontal direction filtering andvertical direction filtering may be processed in parallel.

The offset correction module may correct offset with the originalpicture in units of a pixel in the picture subjected to deblocking. Inorder to perform the offset correction on a particular picture, it ispossible to use a method of applying offset in consideration of edgeinformation of each pixel or a method of partitioning pixels of apicture into the predetermined number of regions, determining a regionto be subjected to perform offset, and applying the offset to thedetermined region.

Adaptive loop filtering (ALF) may be performed based on the valueobtained by comparing the filtered reconstructed picture and theoriginal picture. The pixels included in the picture may be divided intopredetermined groups, a filter to be applied to each of the groups maybe determined, and filtering may be individually performed for eachgroup. Information on whether to apply ALF and a luma signal may betransmitted by coding units (CU). The shape and filter coefficient of afilter for ALF may vary depending on each block. Also, the filter forALF in the same shape (fixed shape) may be applied regardless ofcharacteristics of the application target block.

The memory 155 may store the reconstructed block or picture calculatedthrough the filter module 150. The stored reconstructed block or picturemay be provided to the prediction modules 120 and 125 in performinginter prediction.

FIG. 2 is a block diagram illustrating a device for decoding a videoaccording to an embodiment of the present invention.

Referring to FIG. 2, the device 200 for decoding a video may include: anentropy decoding module 210, a rearrangement module 215, an inversequantization module 220, an inverse transform module 225, predictionmodules 230 and 235, a filter module 240, and a memory 245.

When a video bitstream is input from the device for encoding a video,the input bitstream may be decoded according to an inverse process ofthe device for encoding a video.

The entropy decoding module 210 may perform entropy decoding accordingto an inverse process of entropy encoding by the entropy encoding moduleof the device for encoding a video. For example, corresponding to themethods performed by the device for encoding a video, various methods,such as exponential Golomb coding, context-adaptive variable lengthcoding (CAVLC), and context-adaptive binary arithmetic coding (CABAC)may be applied.

The entropy decoding module 210 may decode information on intraprediction and inter prediction performed by the device for encoding avideo.

The rearrangement module 215 may perform rearrangement on the bitstreamentropy decoded by the entropy decoding module 210 based on therearrangement method used in the device for encoding a video. Therearrangement module may reconstruct and rearrange the coefficients inthe form of one-dimensional vectors to the coefficient in the form oftwo-dimensional blocks. The rearrangement module 215 may receiveinformation related to coefficient scanning performed in the device forencoding a video and may perform rearrangement via a method of inverselyscanning the coefficients based on the scanning order performed in thedevice for encoding a video.

The inverse quantization module 220 may perform inverse quantizationbased on a quantization parameter received from the device for encodinga video and the rearranged coefficients of the block.

The inverse transform module 225 may perform the inverse transform,i.e., inverse DCT, inverse DST, and inverse KLT, which is the inverseprocess of transform, i.e., DCT, DST, and KLT, performed by thetransform module on the quantization result by the device for encoding avideo. Inverse transform may be performed based on a transfer unitdetermined by the device for encoding a video. The inverse transformmodule 225 of the device for decoding a video may selectively performtransform schemes (e.g., DCT, DST, and KLT) depending on multiple piecesof information, such as the prediction method, the size of the currentblock, the prediction direction, etc.

The prediction modules 230 and 235 may generate a prediction block basedon information on prediction block generation received from the entropydecoding module 210 and previously decoded block or picture informationreceived from the memory 245.

As described above, like the operation of the device for encoding avideo, in performing intra prediction, when the size of the predictionunit is the same as the size of the transform unit, intra prediction maybe performed on the prediction unit based on the pixels positioned atthe left, the top left, and the top of the prediction unit. Inperforming intra prediction, when the size of the prediction unit isdifferent from the size of the transform unit, intra prediction may beperformed using a reference pixel based on the transform unit. Also,intra prediction using N×N partitioning may be used for only thesmallest coding unit.

The prediction modules 230 and 235 may include a prediction unitdetermination module, an inter prediction module, and an intraprediction module. The prediction unit determination module may receivea variety of information, such as prediction unit information,prediction mode information of an intra prediction method, informationon motion prediction of an inter prediction method, etc. from theentropy decoding module 210, may divide a current coding unit intoprediction units, and may determine whether inter prediction or intraprediction is performed on the prediction unit. By using informationrequired in inter prediction of the current prediction unit receivedfrom the device for encoding a video, the inter prediction module 230may perform inter prediction on the current prediction unit based oninformation of at least one of a previous picture or a subsequentpicture of the current picture including the current prediction unit.Alternatively, inter prediction may be performed based on information ofsome pre-reconstructed regions in the current picture including thecurrent prediction unit.

In order to perform inter prediction, it may be determined for thecoding unit which of a skip mode, a merge mode, an AMVP mode, and aninter block copy mode is used as the motion prediction method of theprediction unit included in the coding unit.

The intra prediction module 235 may generate a prediction block based onpixel information in the current picture. When the prediction unit is aprediction unit subjected to intra prediction, intra prediction may beperformed based on intra prediction mode information of the predictionunit received from the device for encoding a video. The intra predictionmodule 235 may include an adaptive intra smoothing (AIS) filter, areference pixel interpolation module, and a DC filter. The AIS filterperforms filtering on the reference pixel of the current block, andwhether to apply the filter may be determined depending on theprediction mode of the current prediction unit. AIS filtering may beperformed on the reference pixel of the current block by using theprediction mode of the prediction unit and AIS filter informationreceived from the device for encoding a video. When the prediction modeof the current block is a mode where AIS filtering is not performed, theAIS filter may not be applied.

When the prediction mode of the prediction unit is a prediction mode inwhich intra prediction is performed based on the pixel value obtained byinterpolating the reference pixel, the reference pixel interpolationmodule may interpolate the reference pixel to generate the referencepixel of an integer pixel or less than an integer pixel. When theprediction mode of the current prediction unit is a prediction mode inwhich a prediction block is generated without interpolation thereference pixel, the reference pixel may not be interpolated. The DCfilter may generate a prediction block through filtering when theprediction mode of the current block is a DC mode.

The reconstructed block or picture may be provided to the filter module240. The filter module 240 may include the deblocking filter, the offsetcorrection module, and the ALF.

Information on whether or not the deblocking filter is applied to thecorresponding block or picture and information on which of a strongfilter and a weak filter is applied when the deblocking filter isapplied may be received from the device for encoding a video. Thedeblocking filter of the device for decoding a video may receiveinformation on the deblocking filter from the device for encoding avideo, and may perform deblocking filtering on the corresponding block.

The offset correction module may perform offset correction on thereconstructed picture based on the type of offset correction and offsetvalue information applied to a picture in performing encoding.

The ALF may be applied to the coding unit based on information onwhether to apply the ALF, ALF coefficient information, etc. receivedfrom the device for encoding a video. The ALF information may beprovided as being included in a particular parameter set.

The memory 245 may store the reconstructed picture or block for use as areference picture or block, and may provide the reconstructed picture toan output module.

As described above, in the embodiment of the present invention, forconvenience of explanation, the coding unit is used as a termrepresenting a unit for encoding, but the coding unit may serve as aunit performing decoding as well as encoding.

In addition, a current block may represent a target block to beencoded/decoded. And, the current block may represent a coding treeblock (or a coding tree unit), a coding block (or a coding unit), atransform block (or a transform unit), a prediction block (or aprediction unit), or the like depending on an encoding/decoding step.

A picture may be encoded/decoded by divided into base blocks having asquare shape or a non-square shape. At this time, the base block may bereferred to as a coding tree unit. The coding tree unit may be definedas a coding unit of the largest size allowed within a sequence or aslice. Information regarding whether the coding tree unit has a squareshape or has a non-square shape or information regarding a size of thecoding tree unit may be signaled through a sequence parameter set, apicture parameter set, or a slice header. The coding tree unit may bedivided into smaller size partitions. At this time, if it is assumedthat a depth of a partition generated by dividing the coding tree unitis 1, a depth of a partition generated by dividing the partition havingdepth 1 may be defined as 2. That is, a partition generated by dividinga partition having a depth k in the coding tree unit may be defined ashaving a depth k+1.

A partition of arbitrary size generated by dividing a coding tree unitmay be defined as a coding unit. The coding unit may be recursivelydivided or divided into base units for performing prediction,quantization, transform, or in-loop filtering, and the like. Forexample, a partition of arbitrary size generated by dividing the codingunit may be defined as a coding unit, or may be defined as a transformunit or a prediction unit, which is a base unit for performingprediction, quantization, transform or in-loop filtering and the like.

Partitioning of a coding tree unit or a coding unit may be performedbased on at least one of a vertical line and a horizontal line. Inaddition, the number of vertical lines or horizontal lines partitioningthe coding tree unit or the coding unit may be at least one or more. Forexample, the coding tree unit or the coding unit may be divided into twopartitions using one vertical line or one horizontal line, or the codingtree unit or the coding unit may be divided into three partitions usingtwo vertical lines or two horizontal lines. Alternatively, the codingtree unit or the coding unit may be partitioned into four partitionshaving a length and a width of ½ by using one vertical line and onehorizontal line.

When a coding tree unit or a coding unit is divided into a plurality ofpartitions using at least one vertical line or at least one horizontalline, the partitions may have a uniform size or a different size.Alternatively, any one partition may have a different size from theremaining partitions.

In the embodiments described below, it is assumed that a coding treeunit or a coding unit is divided into a quad tree structure or a binarytree structure. However, it is also possible to divide a coding treeunit or a coding unit using a larger number of vertical lines or alarger number of horizontal lines.

FIG. 3 is a diagram illustrating an example of hierarchicallypartitioning a coding block based on a tree structure according to anembodiment of the present invention.

An input video signal is decoded in predetermined block units. Such adefault unit for decoding the input video signal is a coding block. Thecoding block may be a unit performing intra/inter prediction, transform,and quantization. In addition, a prediction mode (e.g., intra predictionmode or inter prediction mode) is determined in units of a coding block,and the prediction blocks included in the coding block may share thedetermined prediction mode. The coding block may be a square ornon-square block having an arbitrary size in a range of 8×8 to 64×64, ormay be a square or non-square block having a size of 128×128, 256×256,or more.

Specifically, the coding block may be hierarchically partitioned basedon at least one of a quad tree and a binary tree. Here, quad tree-basedpartitioning may mean that a 2N×2N coding block is partitioned into fourN×N coding blocks, and binary tree-based partitioning may mean that onecoding block is partitioned into two coding blocks. Even if the binarytree-based partitioning is performed, a square-shaped coding block mayexist in the lower depth.

Binary tree-based partitioning may be symmetrically or asymmetricallyperformed. In addition, the coding block partitioned based on the binarytree may be a square block or a non-square block, such as a rectangularshape. For example, a partition type in which the binary tree-basedpartitioning is allowed may comprise at least one of a symmetric type of2N×N (horizontal directional non-square coding unit) or N×2N (verticaldirection non-square coding unit), asymmetric type of nL×2N, nR×2N,2N×nU, or 2N×nD.

Binary tree-based partitioning may be limitedly allowed to one of asymmetric or an asymmetric type partition. In this case, constructingthe coding tree unit with square blocks may correspond to quad tree CUpartitioning, and constructing the coding tree unit with symmetricnon-square blocks may correspond to binary tree partitioning.Constructing the coding tree unit with square blocks and symmetricnon-square blocks may correspond to quad and binary tree CUpartitioning.

Binary tree-based partitioning may be performed on a coding block wherequad tree-based partitioning is no longer performed. Quad tree-basedpartitioning may no longer be performed on the coding block partitionedbased on the binary tree.

Furthermore, partitioning of a lower depth may be determined dependingon a partition type of an upper depth. For example, if binary tree-basedpartitioning is allowed in two or more depths, only the same type as thebinary tree partitioning of the upper depth may be allowed in the lowerdepth. For example, if the binary tree-based partitioning in the upperdepth is performed with 2N×N type, the binary tree-based partitioning inthe lower depth is also performed with 2N×N type. Alternatively, if thebinary tree-based partitioning in the upper depth is performed with N×2Ntype, the binary tree-based partitioning in the lower depth is alsoperformed with N×2N type.

On the contrary, it is also possible to allow, in a lower depth, only atype different from a binary tree partitioning type of an upper depth.

It may be possible to limit only a specific type of binary tree basedpartitioning to be used for sequence, slice, coding tree unit, or codingunit. As an example, only 2N×N type or N×2N type of binary tree-basedpartitioning may be allowed for the coding tree unit. An availablepartition type may be predefined in an encoder or a decoder. Orinformation on available partition type or on unavailable partition typeon may be encoded and then signaled through a bitstream.

FIGS. 5A and 5B are diagrams illustrating an example in which only aspecific type of binary tree-based partitioning is allowed. FIG. 5Ashows an example in which only N×2N type of binary tree-basedpartitioning is allowed, and FIG. 5B shows an example in which only 2N×Ntype of binary tree-based partitioning is allowed. In order to implementadaptive partitioning based on the quad tree or binary tree, informationindicating quad tree-based partitioning, information on the size/depthof the coding block that quad tree-based partitioning is allowed,information indicating binary tree-based partitioning, information onthe size/depth of the coding block that binary tree-based partitioningis allowed, information on the size/depth of the coding block thatbinary tree-based partitioning is not allowed, information on whetherbinary tree-based partitioning is performed in a vertical direction, ahorizontal direction, or the like may be used. For example,quad_split_flag indicates whether the coding block is divided into fourcoding blocks, and binary_split_flag indicates whether the coding blockis divided into two coding blocks. When the coding block is divided intotwo coding blocks, is_hor_split_flag indicating whether a partitioningdirection of the coding block is a vertical direction or a horizontaldirection may be signaled.

In addition, information on the number of times a binary treepartitioning is allowed, a depth at which the binary tree partitioningis allowed, or the number of the depths at which the binary treepartitioning is allowed may be obtained for a coding tree unit or aspecific coding unit. The information may be encoded in units of acoding tree unit or a coding unit, and may be transmitted to a decoderthrough a bitstream.

For example, a syntax ‘max_binary_depth_idx_minus1’ indicating a maximumdepth at which binary tree partitioning is allowed may beencoded/decoded through a bitstream. In this case,max_binary_depth_idx_minus1+1 may indicate the maximum depth at whichthe binary tree partitioning is allowed.

Referring to the example shown in FIG. 6, in FIG. 6, the binary treepartitioning has been performed for a coding unit having a depth of 2and a coding unit having a depth of 3. Accordingly, at least one ofinformation indicating the number of times the binary tree partitioningin the coding tree unit has been performed (i.e., 2 times), informationindicating the maximum depth which the binary tree partitioning has beenallowed in the coding tree unit (i.e., depth 3), or the number of depthsin which the binary tree partitioning has been performed in the codingtree unit (i.e., 2 (depth 2 and depth 3)) may be encoded/decoded througha bitstream.

As another example, at least one of information on the number of timesthe binary tree partitioning is permitted, the depth at which the binarytree partitioning is allowed, or the number of the depths at which thebinary tree partitioning is allowed may be obtained for each sequence oreach slice. For example, the information may be encoded in units of asequence, a picture, or a slice unit and transmitted through abitstream. Accordingly, at least one of the number of the binary treepartitioning in a first slice, the maximum depth in which the binarytree partitioning is allowed in the first slice, or the number of depthsin which the binary tree partitioning is performed in the first slicemay be difference from a second slice. For example, in the first slice,binary tree partitioning may be permitted for only one depth, while inthe second slice, binary tree partitioning may be permitted for twodepths.

As another example, the number of times the binary tree partitioning ispermitted, the depth at which the binary tree partitioning is allowed,or the number of depths at which the binary tree partitioning is allowedmay be set differently according to a time level identifier (TemporalID)of a slice or a picture. Here, the temporal level identifier(TemporalID) is used to identify each of a plurality of layers of videohaving a scalability of at least one of view, spatial, temporal orquality.

As shown in FIG. 3, the first coding block 300 with the partition depth(split depth) of k may be partitioned into multiple second coding blocksbased on the quad tree. For example, the second coding blocks 310 to 340may be square blocks having the half width and the half height of thefirst coding block, and the partition depth of the second coding blockmay be increased to k+1.

The second coding block 310 with the partition depth of k+1 may bepartitioned into multiple third coding blocks with the partition depthof k+2. Partitioning of the second coding block 310 may be performed byselectively using one of the quad tree and the binary tree depending ona partitioning method. Here, the partitioning method may be determinedbased on at least one of the information indicating quad tree-basedpartitioning and the information indicating binary tree-basedpartitioning.

When the second coding block 310 is partitioned based on the quad tree,the second coding block 310 may be partitioned into four third codingblocks 310 a having the half width and the half height of the secondcoding block, and the partition depth of the third coding block 310 amay be increased to k+2. In contrast, when the second coding block 310is partitioned based on the binary tree, the second coding block 310 maybe partitioned into two third coding blocks. Here, each of two thirdcoding blocks may be a non-square block having one of the half width andthe half height of the second coding block, and the partition depth maybe increased to k+2. The second coding block may be determined as anon-square block of a horizontal direction or a vertical directiondepending on a partitioning direction, and the partitioning directionmay be determined based on the information on whether binary tree-basedpartitioning is performed in a vertical direction or a horizontaldirection.

In the meantime, the second coding block 310 may be determined as a leafcoding block that is no longer partitioned based on the quad tree or thebinary tree. In this case, the leaf coding block may be used as aprediction block or a transform block.

Like partitioning of the second coding block 310, the third coding block310 a may be determined as a leaf coding block, or may be furtherpartitioned based on the quad tree or the binary tree.

In the meantime, the third coding block 310 b partitioned based on thebinary tree may be further partitioned into coding blocks 310 b-2 of avertical direction or coding blocks 310 b-3 of a horizontal directionbased on the binary tree, and the partition depth of the relevant codingblocks may be increased to k+3. Alternatively, the third coding block310 b may be determined as a leaf coding block 310 b-1 that is no longerpartitioned based on the binary tree. In this case, the coding block 310b-1 may be used as a prediction block or a transform block. However, theabove partitioning process may be limitedly performed based on at leastone of the information on the size/depth of the coding block that quadtree-based partitioning is allowed, the information on the size/depth ofthe coding block that binary tree-based partitioning is allowed, and theinformation on the size/depth of the coding block that binary tree-basedpartitioning is not allowed.

A number of a candidate that represent a size of a coding block may belimited to a predetermined number, or a size of a coding block in apredetermined unit may have a fixed value. As an example, the size ofthe coding block in a sequence or in a picture may be limited to have256×256, 128×128, or 32×32. Information indicating the size of thecoding block in the sequence or in the picture may be signaled through asequence header or a picture header.

As a result of partitioning based on a quad tree and a binary tree, acoding unit may be represented as square or rectangular shape of anarbitrary size.

As a result of a division based on the quadtree and the binary tree, acoding block which is not further partitioned can be used as aprediction block or a transform block. That is, in a QTBT partitioningmethod based on a quad tree and binary tree, a coding block may become aprediction block and a prediction block may become a transform block.For example, when the QTBT partitioning method is used, a predictionimage may be generated in a unit of a coding block, and a residualsignal, which is a difference between an original image and theprediction image, is transformed in a unit of a coding block. Here,generating the prediction image in a unit of a coding block may meanthat motion information is determined for a coding block or an intraprediction mode is determined for a coding block.

In the QTBT partitioning method, it may be set that only symmetricpartitioning is allowed in BT. However, if only symmetric binarypartitioning is allowed even though an object and a background aredivided at a block boundary, coding efficiency may be lowered.Accordingly, in the present invention, a method of partitioning a codingblock asymmetrically is proposed in order to increase the codingefficiency.

Asymmetric binary tree partitioning represents dividing a coding blockinto two smaller coding blocks. As a result of the asymmetric binarytree partitioning, the coding block may be divided into two codingblocks of an asymmetric form. For convenience of explanation, in thefollowing embodiments, dividing a coding block into two partitions of asymmetrical form will be referred to as a binary tree partition (orbinary tree partitioning), and dividing a coding block into towpartitions of an asymmetric form will be referred to as an asymmetricbinary tree partition (or asymmetric binary tree partitioning).

FIG. 7 illustrates a partition type of a coding block based onasymmetric binary tree partitioning. A coding block of 2N×2N may bedivided into two coding blocks whose width ratio is n:(1−n) or twocoding blocks whose height ratio is n:(1−n). Where n may represent areal number greater than 0 and less than 1.

It is illustrated in FIG. 7 that two coding blocks whose width ratio is1:3 or 3:1 or whose height ratio is 1:3 or 3:1 are generated by applyingthe asymmetric binary tree partitioning to a coding block.

Specifically, as a coding block of W×H size is partitioned in a verticaldirection, a left partition whose width is ¼W and a right partitionwhose width is ¾W may be generated. As described above, a partition typein which the width of the left partition is smaller than the width ofthe right partition can be referred to as nL×2N binary partition.

As a coding block of W×H size is partitioned in a vertical direction, aleft partition whose width is ¾W and a right partition whose width is ¼Wmay be generated. As described above, a partition type in which thewidth of the right partition is smaller than the width of the leftpartition can be referred to as nR×2N binary partition.

As a coding block of W×H size is partitioned in a horizontal direction,a top partition whose width is ¼H and a bottom partition whose width is¾H may be generated. As described above, a partition type in which theheight of the top partition is smaller than the height of the bottompartition can be referred to as 2N×nU binary partition.

As a coding block of W×H size is partitioned in a horizontal direction,a top partition whose width is ¾H and a bottom partition whose width is¼H may be generated. As described above, a partition type in which theheight of the bottom partition is smaller than the height of the toppartition can be referred to as 2N×nD binary partition.

In FIG. 7, it is illustrated that a width ratio or a height ratiobetween two coding blocks is 1:3 or 3:1. However, the width ratio or theheight ratio between two coding blocks generated by asymmetric binarytree partitioning is not limited thereto. The coding block may bepartitioned into two coding blocks having different width ratio ordifferent height ratio from those shown in the FIG. 7.

When the asymmetric binary tree partitioning is used, an asymmetricbinary partition type of a coding block may be determined based oninformation signaled via a bitstream. For example, a partition type of acoding block may be determined based on information indicating apartitioning direction of the coding block and information indicatingwhether a first partition, generated by dividing the coding block, has asmaller size than a second partition.

The information indicating the partitioning direction of the codingblock may be a flag of 1 bit indicating whether the coding block ispartitioned in a vertical direction or in a horizontal direction. Forexample, hor_binary_flag may indicate whether the coding block ispartitioned in a horizontal direction. If a value of hor_binary_flag is1, it may indicate that the coding block is partitioned in thehorizontal direction and if the value of hor_binary_flag is 0, it mayindicate that the coding block is partitioned in the vertical direction.Alternatively, ver_binary_flag indicating whether or not the codingblock is partitioned in the vertical direction may be used.

The information indicating whether the first partition has a smallersize than the second partition may be a flag of 1 bit. For example,is_left_above_small_part_flag may indicate whether a size of a left ortop partition generated by dividing the coding block is smaller than aright or bottom partition. If a value of is_left_above_small_part_flagis 1, it means that the size of the left or top partition is smallerthan the right or bottom partition. If the value ofis_left_above_small_part_flag is 0, it means that the size of the leftor top partition is larger than the right or bottom partition.Alternatively, is_right_bottom_small_part_flag indicating whether thesize of the right or bottom partition is smaller than the left or toppartition may be used.

Alternatively, sizes of a first partition and a second partition may bedetermined by using information indicating a width ratio, a height ratioor an area ratio between the first partition and the second partition.

When a value of hor_binary_flag is 0 and a value ofis_left_above_small_part_flag is 1, it may represent nL×2N binarypartition, and when a value of hor_binary_flag is 0 and a value ofis_left_above_small_part_flag is 0, it may represent nR×2N binarypartition. In addition, when a value of hor_binary_flag is 1 and a valueof is_left_above_small_part_flag is 1, it may represent 2N×nU binarypartition, and when a value of hor_binary_flag is 1 and a value ofis_left_above_small_part_flag is 0, it may represent 2N×nD binarypartition.

As another example, the asymmetric binary partition type of the codingblock may be determined by index information indicating a partition typeof the coding block. Here, the index information is information to besignaled through a bitstream, and may be encoded with a fixed length(i.e., a fixed number of bits) or may be encoded with a variable length.For example, Table 1 below shows the partition index for each asymmetricbinary partition.

TABLE 1 Asymmetric partition index Binarization nLx2N 0 0 nRx2N 1 102NxnU 2 100 2NxnD 3 111

Asymmetric binary tree partitioning may be used depending on the QTBTpartitioning method. For example, if the quadtree partitioning or thebinary tree partitioning is no longer applied to the coding block, itmay be determined whether or not to apply asymmetric binary treepartitioning to the coding block. Here, whether or not to apply theasymmetric binary tree partitioning to the coding block may bedetermined by information signaled through the bitstream. For example,the information may be a 1 bit flag ‘asymmetric_binary_tree_flag’, andbased on the flag, it may be determined whether the asymmetric binarytree partitioning is applied to the coding block.

Alternatively, when it is determined that the coding block ispartitioned into two blocks, it may be determined whether the partitiontype is binary tree partitioning or asymmetric binary tree partitioning.Here, whether the partition type of the coding block is the binary treepartitioning or the asymmetric binary tree partitioning may bedetermined by information signaled through the bitstream. For example,the information may be a 1 bit flag ‘is_asymmetric_split_flag’, andbased on the flag, it may be determined whether the coding block ispartitioned into a symmetric form or an asymmetric from.

As another example, indexes assigned to symmetric type binary partitionsand to asymmetric type binary partitions may be different, and it may bedetermined based on index information whether the coding block ispartitioned in a symmetric type or an asymmetric type. For example,Table 2 shows an example in which different indexes are assigned tosymmetric binary type partitions and asymmetric binary type partitions.

TABLE 2 Binary partition index Binarization 2NxN (Binary 0 0 partitionin horizontal direction) Nx2N (Binary 1 10 partition in verticaldirection) nLx2N 2 110 nRx2N 3 1110 2NxnU 4 11110 2NxnD 5 11111

A coding tree block or a coding block may be divided into a plurality ofcoding blocks by quad tree partitioning, binary tree partitioning orasymmetric binary tree partitioning. For example, FIG. 8 shows anexample in which a coding block is divided into a plurality of codingblocks using QTBT and asymmetric binary tree partitioning. Referring toFIG. 8, it can be seen that the asymmetric binary tree partitioning isperformed in depth 2 partitioning in the first drawing, depth 3partitioning in the second drawing, and depth 3 partitioning in thethird drawing, respectively.

It may be restricted that a coding block divided by the asymmetricbinary tree partitioning is no longer divided. For example, informationrelated to a quadtree, binary tree, or asymmetric binary tree may not beencoded/decoded for a coding block which is generated by the asymmetricbinary tree partitioning. That is, for a coding block generated throughthe asymmetric binary tree partitioning, a flag indicating whetherquadtree partitioning is applied, a flag indicating whether binary treepartitioning is applied, a flag indicating whether asymmetric binarytree partitioning is applied, a flag indicating a direction of thebinary tree partitioning or the asymmetric binary tree partitioning, orindex information indicating an asymmetric binary partition, or the likemay be omitted.

As another example, whether or not to allow the binary tree partitioningmay be determined depending on whether the QTBT is allowed or not. Forexample, in a picture or slice in which the QTBT-based partitioningmethod is not used, it may be restricted not to use the asymmetricbinary tree partitioning.

Information indicating whether the asymmetric binary tree partitioningis allowed may be encoded and signaled in a unit of a block, a slice ora picture. Here, the information indicating whether the asymmetricbinary tree partitioning is allowed may be a flag of 1 bit. For example,if a value of is_used_asymmetric_QTBT_enabled_flag is 0, it may indicatethat the asymmetric binary tree partitioning is not used. It is alsopossible that is_used_asymmetric_QTBT_enabled_Flag is set to 0 withoutsignaling thereof when the binary tree partitioning is not used in apicture or a slice.

It is also possible to determine a partition type allowed in a codingblock based on a size, a shape, a partition depth, or a partition typeof the coding block. For example, at least one of partition types,partition shapes or a number of partitions allowed in a coding blockgenerated by the quad tree partitioning and in a coding block generatedby the binary tree partitioning may be different from each other.

For example, if a coding block is generated by the quadtreepartitioning, all of the quadtree partitioning, the binary treepartitioning, and the asymmetric binary tree partitioning may be allowedfor the coding block. That is, if a coding block is generated based onquad tree partitioning, all partition types shown in FIG. 9 can beapplied to the coding block. For example, a 2N×2N partition mayrepresent a case where a coding block is not further divided, N×N mayrepresent a case where a coding block is partitioned in a quad-tree, andN×2N and 2N×N may represent a case where a coding block is partitionedin a binary tree. In addition, nL×2N, nR×2N, 2N×nU, and 2N×nD mayrepresent cases where a coding block is partitioned in an asymmetricbinary tree.

On the other hand, when a coding block is generated by the binary treepartitioning, it may not be allowed to use the asymmetric binary treepartitioning for the coding block. That is, when the coding block isgenerated based on the binary tree partitioning, it may be restrictednot to apply the asymmetric partition type (nL×2N, nR×2N, 2N×nU, 2N×nD)among the partition types shown in FIG. 9 to the coding block.

When QTBT is used, a coding block which is not further divided can beused as a prediction block. That is, the coding block can be encodedusing at least one of a skip mode, an intra prediction, an interprediction, or a skipping method.

As another example, if a coding block is determined, a prediction blockhaving the same size as the coding block or smaller size than the codingblock may be determined through predictive partitioning of the codingblock. Predictive partitioning of a coding block may be performed by apartition mode (Part mode) indicating a partition type of the codingblock. A size or a shape of a prediction block may be determinedaccording to the partition mode of the coding block. The partition typeof the coding block may be determined through information specifying anyone of partition candidates. At this time, the partition candidatesavailable to the coding block may include an asymmetric partition type(for example, nL×2N, nR×2N, 2N×nU, 2N×nD) depending on a size, a shapeor an encoding mode of the coding block. For example, partitioncandidates available to a coding block may be determined according to anencoding mode of a current block. For example, FIG. 10 is a diagramillustrating a partition mode that can be applied to a coding block whenthe coding block is encoded by inter prediction.

If a coding block is encoded by an inter prediction, one of 8 partitionmodes illustrated in FIG. 10 may be applied to the coding block.

On the other hand, when a coding block is encoded by intra prediction, apartition mode of PART_2N×2N or PART_N×N may be applied to the codingblock.

PART_N×N may be applied when a coding block has a minimum size. Here,the minimum size of the coding block may be pre-defined in the encoderand the decoder. Alternatively, information regarding the minimum sizeof the coding block may be signaled via the bitstream. For example, theminimum size of the coding block is signaled through a slice header, sothat the minimum size of the coding block may be defined per slice.

In another example, partition candidates available to a coding block maybe determined differently depending on at least one of a size or shapeof the coding block. For example, the number or type of partitioncandidates available to a coding block may be differently determinedaccording to at least one of a size or shape of the coding block.

Alternatively, a type or number of asymmetric partition candidates amongpartition candidates available to a coding block may be limiteddepending on a size or shape of the coding block. For example, thenumber or type of asymmetric partition candidates available to a codingblock may be differently determined according to at least one of a sizeor shape of the coding block.

In general, a prediction block may have a size from 64×64 to 4×4.However, when a coding block is encoded by inter prediction, it ispossible to prevent the prediction block to have 4×4 size in order toreduce the memory bandwidth when performing motion compensation.

As another example, at least one of a prediction block or a transformblock may be generated by merging a plurality of coding blocks. Theprediction block or the transform block generated by merging a pluralityof coding blocks can be referred to as a merge prediction block or amerge transform block. Accordingly, the prediction block or thetransform block may be larger than a size of the coding block.Hereinafter, an example of generating the merge prediction block and themerge transform block will be described in detail.

FIG. 11 is a diagram illustrating an example in which a merge predictionblock is generated. If a coding block is divided into a plurality ofcoding blocks based on QTBT partitioning or an asymmetric binary treepartitioning, at least one of final divided coding blocks may be mergedwith another to generate a merge prediction block. For example, it isillustrated in an above drawing in FIG. 11 that a merge prediction blockis generated by merging two blocks whose sizes are different from eachother, and it is illustrated in a below drawing in FIG. 11 that a mergeprediction block is generated by merging two blocks whose sizes are thesame.

Intra prediction or inter prediction for the current block may beperformed in a unit of a merge prediction block or a coding block.

Even when intra prediction or inter prediction is performed in a unit ofa coding block, single motion information may be defined for each mergeprediction block, or single intra prediction mode may be may be definedfor each merge prediction block. That is, a plurality of coding blocksincluded in the merge prediction block may share the motion informationor the intra prediction mode. Here, the motion information may includeat least one of a merge candidate (or a merge candidate list), an AMVPcandidate (or an AMVP candidate list), a candidate index, a motionvector, a reference picture index, or a list utilization flag.

Alternatively, a merge transform block may be divided into a pluralityof sub-blocks. And it is also possible to use different motioninformation or different intra prediction modes for each sub-block. Inthis case, the number of sub-blocks may be different from the number ofcoding blocks included in the merge prediction block.

A coding block that can be merged with a coding block that is currentencoding/decoding target (hereinafter referred to as a current codingblock) can be referred to as a merge target candidate block. The mergetarget candidate block may include a coding block neighboring thecurrent coding block. For example, a coding block neighboring a leftside or a top side of the current coding block may be included in themerge target candidate block of the current coding block. Alternatively,a coding block neighboring a right side or a bottom side of the currentcoding block, or a coding block adjacent to one corner of the currentcoding block may also be used as the merge target candidate block of thecurrent coding block.

The merge target candidate block of the current coding block may belimited by at least one of a width, a height, or a size of the currentcoding block.

For example, a neighboring coding block having a width or a height equalto a width or a height of the current coding block may be used as amerge target candidate block of the current coding block. A coding blockneighboring a top of the current coding block can be used as the mergetarget candidate block of the current coding block only when it has asame width as the current coding block, and a coding block neighboring aleft of the current coding block can be used as the merge targetcandidate block of the current coding block only when it has a sameheight as the current coding block.

For example, a neighboring block having the same size as the currentcoding block (i.e., a coding block having the same width and the sameheight as the current coding block) among neighboring coding blocksadjacent to the current coding block can be used as a merge targetcandidate block of the current coding block. On the other hand, if asize of a neighboring coding block is different from the current block,the coding block cannot be used as a merge target candidate block of thecurrent coding block.

That is, all of a left coding block and a top coding block may be usedas a merge target candidate block of the current block or only one ofthe left coding block and the top coding block may be used as a mergetarget candidate block of the current block depending on whether theyhave the same width, the same height, or the same size as the currentcoding block. Or, it is also possible that all of neighboring codingblocks adjacent to the current coding block may be unavailable as amerge target candidate block.

A merge target candidate block of the current coding block may belimited by a shape of the current coding block. For example, if thecurrent coding block is a non-square block having a width greater than aheight, such as 2N×N, a coding block adjacent to a top of the currentcoding block may be set as a merge target candidate block of the currentcoding block. On the other hand, if the current coding block is anon-square block having a height greater than a width, such as N×2N, acoding block adjacent to a left of the current coding block may be setas a merge target candidate block of the current coding block.

Generating a merge prediction block by merging the current coding blockwith a neighboring coding block can be referred to as a prediction blockmerging method. At this time, whether or not the prediction blockmerging method is allowed for the current coding block may be determinedbased on at least one of a size, a shape, a partition depth, a position,an encoding mode, or an intra prediction mode of the current codingblock. For example, the prediction block merging method may be allowedonly when a size of the current coding block is less than or equal to apredetermined size.

In addition, whether to merge the current coding block with a mergetarget candidate block may be determined based on information signaledfrom the bitstream. The information may be a flag of 1 bit, and it maybe determined based on the information whether to merge the currentcoding block with the merge target candidate block.

If there are a plurality of merge target candidate blocks of the currentcoding block, index information specifying one of the plurality of mergetarget candidate blocks may be encoded/decoded. A merge prediction blockmay be generated by merging the current coding block with a merge targetcandidate block specified by the index information.

A merge transform block may be generated by merging a plurality ofcoding blocks. That is, the merge transform block may include aplurality of coding blocks. The merge transform block may be used as abase unit for a transform or a quantization of residual signals (ortransform coefficients). Accordingly, the same transform scheme can beapplied to transform coefficients included in the merge transform block.

Alternatively, the merge transform block may be divided into a pluralityof sub-blocks. And, it is also possible to perform a quantization or atransform on each sub-block. Accordingly, a different transform schememay be applied to each sub-block. In this case, the number of sub-blocksmay be different from the number of coding blocks included in the mergetransform block.

The merge transform block may be set the same as the merge predictionblock, or may be set to have a different size or different shape fromthe merge prediction block.

For example, the merge transform block may be generated following themerge predict block. That is, the merge transform block may have thesame size and shape as the merge prediction block.

In another example, the merge transform block may be generatedindependently of the merge predicting block. That is, the mergetransform block may be generated based on information indicating whetherto merge the current coding block with a neighboring coding block, indexinformation indicating a neighboring coding block which will be mergedwith the current coding block, or the like.

It is also possible to signal information indicating whether to set themerge transform block equal to the merge prediction block through thebit stream.

A merge prediction block or a merge transform block generated by mergingcoding blocks may be limited to a predetermined size or a predeterminedshape. That is, it may be determined whether to merge two coding blocksbased on whether the merge prediction block or the merge transformblock, which is generated by merging two coding blocks, has thepredetermined size or the predetermined shape. For example, the mergeprediction block or the merge transform block may be limited to arectangle shape or a square shape.

In another example, it is also possible that the merge prediction blockor the merge transform block has a non-rectangular shape. For example,if the current coding block is merged with a coding block neighboring aleft side of the current coding block and a coding block neighboring atop side of the current coding block, the merge prediction block or themerge transform block of non-rectangular shape may be generated.

FIG. 12 is a diagram illustrating an example in which a merge predictionblock is generated by merging a plurality of coding blocks. In theexample shown in FIG. 12, a coding block is merged with two codingblocks neighboring to left and top sides of the coding block, so thatthe merge prediction block that is not a rectangular shape is generated.

If the merge prediction block is not a rectangular shape, the mergeprediction block may be divided into square-shaped sub-blocks, andprediction may be performed in a unit of a sub-block. At this time, allsub-blocks in the merge prediction block may use the same motioninformation or may use the same intra prediction mode.

When performing intra prediction on the merge prediction block of anon-rectangular shape, reference samples for the merge prediction blockmay be derived from neighboring samples adjacent to the merge predictionblock. At this time, the neighboring samples may include a samplebordering a boundary of the merge prediction block. Accordingly, topreference samples or left reference samples of the merge predictionblock may be not arranged in a line according to a shape of the mergeprediction block.

For example, FIG. 13 is a diagram illustrating reference samples of amerge prediction block. In FIG. 13, reference samples of the mergeprediction block are shown distributed along a top boundary and a leftboundary of the merge prediction block.

In another example, reference samples of the merge prediction block maybe derived from neighboring samples included in a row or column adjacentto the top most boundary of the merge prediction block and the left mostboundary of the merge prediction block. Accordingly, top referencesamples or left reference samples of the merge prediction block may bearranged in a line regardless of a shape of the merge prediction block.

For example, FIG. 14 is a diagram illustrating a reference sample of amerge prediction block. In FIG. 14, reference samples of the mergeprediction block are shown distributed along the top most boundary andthe left most boundary of the merge prediction block.

If a merge transform block is not a rectangular shape, the mergetransform block may be divided into sub-blocks of a rectangular shape,and a quantization and/or a transform may be performed in a unit of asub-block. At this time, all sub-blocks in the merge prediction blockmay use the same transform scheme.

Information indicating whether the prediction block merging method orthe transform block merging method is allowed within a predeterminedunit may be signaled through the bitstream. For example, informationindicating whether the prediction block merging method or the transformblock merging method is allowed in a picture, a slice or a block (e.g.,CTU) may be signaled.

The above described block merging methods (i.e., the prediction blockmerging method or the transform block merging method) may not be used incombination with the asymmetric binary tree partitioning method. Thatis, asymmetric blocks may be generated by selectively using either theasymmetric binary tree partitioning method or the block merging methodafter dividing the coding block based on the QTBT.

In the above examples, it is described that the merge prediction blockor the merge transform block having a size greater than a coding blockby merging coding blocks, however, it is also possible to set a size ofthe merge prediction block or the merge transform block same as thecoding block. That is, a plurality of coding blocks may be merged togenerate a merge coding block, and the generated merge coding block maybe used as the merge prediction block or the merge transform block.

FIG. 15 is a flowchart illustrating a block merging method according toan embodiment of the present invention.

First, a merge target candidate block for a current coding block to bedecoded/encoded may be determined S1510. The merge target candidateblock for the current coding block may be derived from neighboringblocks adjacent to the current coding block. At this time, whether aneighboring block adjacent to the current coding block is available asthe merge target candidate block may be determined based on at least oneof a height, a width or a size of the current coding block.

If merge target candidate blocks for the current coding block isdetermined, a merged target candidate block to be merged with thecurrent coding block may be specified S1520. Specifically, the mergetarget candidate block to be merged with the current coding block may bedetermined based on index information specifying at least one of mergetarget candidate blocks of the current block.

If the merge target candidate block for the current coding block isdetermined, a merged block may be generated by merging the currentcoding block and the determined merge target candidate block S1530. Themerged block may be used as a prediction block, which is a basic unit ofprediction, or as a transform block, which is a basic unit ofencoding/decoding residual signal.

The encoder may perform a transform or a quantization on a residualsample (or residual signal) in a unit of a predetermined block, andthereby generate a residual coefficient. Here, the unit of thepredetermined block, which is a unit for performing the transform or thequantization, may have the same size for each color component or mayhave different sizes for each color component. For example, a residualcoefficient may be generated for each of a luminance component (Luma)and each chrominance component (Cb, Cr) in different block units.

The block unit in which the transform or the quantization is performedcan be referred to as a transform block, and the transform block mayhave a square shape or a non-square shape. For example, the transformblock may have a square shape such as 4×4, 8×, 16×16, 32×32, or 64×64,or may have a non-square shape, such as 4×8, 8×4, 8×16, 16×8, 16×32,32×16, 32×64, 64×32, 4×16, 4×32, or 8×32.

The decoder may decode a residual coefficient from the bitstreamreceived from the encoder and may perform at least one of an inversequantization or an inverse transform on the decoded residual signal todecode a residual sample (or residual signal). The processes ofgenerating the residual signal by decoding the residual coefficient andby generating the residual signal by performing at least one of theinverse quantization and the inverse transform on the decoded residualsignal may be defined as ‘residual coefficient decoding’.

Hereinafter, the residual coefficient decoding processes will bedescribed in detail.

FIG. 16 is a flowchart illustrating processes of obtaining a residualsample according to an embodiment to which the present invention isapplied.

The decoder may decode information indicating whether a non-zerotransform coefficient exists in a current block from the bitstreamS1610, and may determine whether to decode a residual coefficient of thecurrent block based on the information S1620.

The information may include a transform coefficient coded indicator(coded block flag, CBF) indicating whether or not a transformcoefficient exists in the current block. The transform coefficient codedindicator may indicate whether a non-zero transform coefficient existsin a block of a predetermined unit. For example, if the transformcoefficient coded indicator is 0, it indicates that there is no non-zerotransform coefficient in the block of the predetermined unit, and if thetransform coefficient coded indicator is 1, it indicates that at leastone non-zero transform coefficient exists in the block of thepredetermined unit. The transform coefficient coded indicator may beencoded and signaled for each of a luminance component and a chrominancecomponent.

The transform coefficient coded indicator may include at least one of anindicator (i.e., ‘rqt_root_cbf’) signaled in a unit of a block (e.g., atransform block, a coding block or a coding tree block) or an indicator(e.g., ‘coded sub block flag’) signaled in a unit of a sub-block of apre-determined size.

For example, rqt_root_cbf may indicate whether or not a non-zerotransform coefficient is included in the current block. The decoder maydetermine whether to decode the residual coefficient according to avalue of the rqt_root_cbf. For example, if rqt_root_cbf is 0, decodingof a transform coefficient for the current block (e.g., the currenttransform block) is not performed, and values of all residual samples inthe current block may be set to zero. On the other hand, if rqt_root_cbfis 1, decoding of a transform coefficient for the current block may beperformed.

The coded sub block flag may indicate whether or not a non-zerocoefficient is included in a sub-block of a predetermined size. Forexample, the coded sub block flag may be encoded and signaled in a unitof a sub-block of 4×4 size. If the coded sub block flag is 0, it maymean that there is no non-zero transform coefficient in a sub-block of apredetermined size, and if the coded sub block flag is 1, it may meanthat at least one non-zero transform coefficient exists in a sub-blockof a predetermined size.

The rqt_root_cbf and the coded sub block flag may be hierarchicallyencoded and signaled. For example, when the rqt_root_cbf is 0, encodingof the coded sub block flag may be omitted. On the other hand, when therqt_root_cbf is 1 and the current block size is larger than a sub-block,the coded sub block flag may be encoded and signaled in a unit of asub-block of a predetermined size in the current block.

The transform coefficient coded indicator may be hierarchically encodedand signaled between a transform block and a coding block. A firsttransform coefficient coded indicator indicating whether or not at leastone transform block including a non-zero transform coefficient among aplurality of transform blocks is included may be encoded/decoded. Andthen, according to a value of the first transform coefficient codedindicator, it may be determined whether to encode/decode a secondtransform coefficient coded indicator for each sub-block. Here, at leastone of a size or a shape of an upper node block including the pluralityof transform blocks may be a pre-determined value or may be determinedbased on information decoded from the bitstream. Alternatively, at leastone of a size or a shape of the upper node block may be determined basedon a partition type of a coding tree block. For example, a non-squarecoding block or a square coding block including the plurality oftransform blocks may be defined as the upper node block for theplurality of non-square transform blocks. Transform coefficient codedindicators may be hierarchically encoded through two or more layers.

As described above, a method of hierarchically encoding transformcoefficient coded indicators will be referred to as a hierarchicaltransform coefficient coded indicator (Hierarchical Coded Block Flag,HCBF) deriving method.

When at least one non-zero transform coefficient is included in thecurrent block, a transform coefficient may be decoded using a transformcoefficient level indicator indicating whether the transform coefficientis 0 or not. The transform coefficient level indicator is a 1 bit flag(e.g., ‘significant flag’) and indicates whether each transformcoefficient in the current block is 0 or not. For example, if thesignificant flag is 1, it indicates that the transform coefficient isnot 0, and if the significant flag is 0, it indicates that the transformcoefficient is 0.

It will be referred to as a transform coefficient level map (SignificantMap) which shows whether each of transform coefficients is 0 or not. Theencoder may encode the transform coefficient coded indicator and thetransform coefficient level indicator for each transform coefficientaccording to the transform coefficient level map, and may encode anabsolute value and a sign of a non-zero transform coefficient. Thedecoder may decode the transform coefficient level map according to thetransform coefficient coded indicator and the transform coefficientlevel indicator, and may decode the absolute value and the sign of thenon-zero transform coefficient.

FIG. 17 is a diagram illustrating a transform coefficient level map.Values shown in FIG. 17 indicate values of transform coefficient levelindicators. And, coded_sub_block_flag indicates whether or not anon-zero transform coefficient exists for a sub-block of 4×4.

A sub-block of a predetermined size for which information indicatingwhether a non-zero transform coefficient exists or not isencoded/decoded may be referred to as a transform coefficient basicblock. For example, in FIG. 17, a block of 4×4 size in which thecoded_sub_block_flag is encoded may be defined as the transformcoefficient basic block.

At this time, at least one of a shape or a size of the transformcoefficient basic block may be determined differently according to atleast one of a shape or a size of the coding block or the transformblock. For example, if the current block has a square-shape, thetransform coefficient basic block of the current block may have asquare-shape, and if the current block has a non-square shape, thetransform coefficient basic block of the current block may also have anon-square shape. For example, when the current block has a non-squareshape such as N×2N or N×4N, the transform coefficient basic block of thecurrent block may be 2×8, and if the current block has a non-squareshape such as 2N×N or 4N×N, the transform coefficient basic block of thecurrent block may be 8×2.

As a result of the quadtree partitioning and the binary treepartitioning, a coding tree block or a coding block may include atransform block of 2×8, 8×2, 4×16, or 16×4. As described above, when thebinary tree partitioning is used in addition to the quadtreepartitioning, a larger number of transform blocks or more various shapesof transform blocks can be included in in a coding tree block than inthe case of using only the quad tree partitioning. As the number oftransform blocks increases or as the shapes of the transform blocks arediversified, encoding a transform coefficient coded indicator for everytransform block may reduce coding efficiency.

Thus, in an embodiment of the present invention, instead of encoding thetransform coefficient coded indicator in a unit of a transform block, itis possible to encode/decode the transform coefficient coded indicatorin a unit of a predetermined unit or it is possible to determine whetherto encode/decode the transform coefficient coded indicator for a currentblock by comparing a size of the current block with the predeterminedunit. Here, the predetermined unit may be defined by a size of a block,a shape of a block, or the number of samples.

The encoder may encode and signal information for determining apredetermined unit (for example, a transform coefficient encoding unitindicator). The information may indicate a size, a shape, or the numberof samples of a block. Also, the information may be encoded and signaledin at least one of a video sequence level, a picture parameter set, aslice header, or a block level.

If the predetermined unit is related to a size or the number of samplesof a block, and if the current block is smaller than the predeterminedunit, information on whether or not the current block includes anon-zero transform coefficient may be encoded and signaled in a unit ofthe predetermined unit. On the other hand, if the current block is equalto or larger than the predetermined unit, the transform coefficientcoded indicator may be encoded and signaled for the current block.

FIG. 18 is a diagram for explaining an aspect in which a transformcoefficient coded indicator is decoded based on a predetermined unit.

When a predetermined unit represents 256 samples, the transformcoefficient coded indicator may be encoded and signaled based on a blockincluding 256 or more samples. Accordingly, in the example shown in FIG.18, a transform coefficient coded indicator indicating whether or not anon-zero transform coefficient exists may be decoded for a block of16×16 or a block of 8×32.

The transform coefficient coded indicator also can be encoded andsignaled for a block including more than 256 samples. Accordingly, inthe example shown in FIG. 18, the transform coefficient coded indicatorindicating whether or not a non-zero transform coefficient exists may bedecoded for a block of 16×32 size or a block of 32×32 size.

When a predetermined unit indicates 1024 samples, the transformcoefficient coded indicator may be encoded and signaled based on a blockincluding 1024 or more samples. Accordingly, in the example shown inFIG. 17, single transform coefficient coded indicator may decoded for anupper node block including four square blocks of 16×16 size, and singletransform coefficient coded indicator may decoded for an upper nodeblock including two non-square blocks of 8×32 size and a non-squareblock of 16×32 size.

The transform coefficient coded indicator may be individually encodedand signaled for blocks including more than 1024 samples. Accordingly,in the example shown in FIG. 18, the transform coefficient codedindicator may be decoded for a 32×32 block.

A predetermined unit may indicate a maximum unit in which a transformcoefficient coded indicator is encoded and signaled. That is, a maximumsize of a block or a shape of a block to which a transform coefficientcoded indicator is encoded may be defined based on the predeterminedunit. In this case, a unit in which the transform coefficient issignaled may be determined adaptively by comparing the number of samplesindicated by the transform coefficient encoding unit indicator and thenumber of samples included in the transform block.

For example, when the number of samples indicated by the transformcoefficient encoding unit indicator is larger than the number of samplesincluded in a transform block, the transform coefficient coded indicatormay be encoded and signaled for the transform block. On the other hand,when the number of samples indicated by the transform coefficientencoding unit indicator is smaller than the number of samples includedin a transform block, the transform block is divided into a plurality ofregions according to the predetermined unit, and the transformcoefficient coded indicator is encoded for each region.

If a residual coefficient other than 0 is included in the current block,a scanning order for the current block may be determined S1630. Then, inaccordance with the determined scanning order, an absolute value or asign of each transform coefficient may be decoded S1640.

The decoder may select a scanning order of the current block among aplurality of scanning order candidates. Here, the plurality of scanningorder candidates may include at least one of a diagonal scan, ahorizontal scan, and a vertical scan. For example, FIG. 19 is a diagramillustrating a decoding order of transform coefficients according toeach scanning order.

A scanning order of the current block may be determined based on atleast one of a size, a shape, an encoding mode, or an intra predictionmode of the current block (for example, a transform block or a codingblock). Here, a size of the current block may be represented by at leastone of a width, a height, or an area of a block.

For example, a scanning order of the current block may be determined bycomparing a size of the current block with a predetermined thresholdvalue. Here, the predetermined threshold value may be expressed by amaximum value or a minimum value.

For example, a transform block or a coding block of 4×4 or 8×8 sizeencoded in intra mode may use a vertical scan, a horizontal direction,or a diagonal scan according to an intra prediction mode. Specifically,when the intra prediction mode has a horizontal direction, the verticalscan may be used. When the intra prediction mode has a verticaldirection, the horizontal scan may be used. For other intra predictionmodes, the diagonal scan may be used. On the other hand, the diagonalscan may be used for a transform block or a coding block encoded ininter mode or a transform block or a coding block having a size of 16×16or more encoded in intra mode.

Alternatively, based on at least one of a size, a shape, an encodingmode, or an intra prediction mode of the current block, at least one ofthe number or types of scanning order candidates available for thecurrent block may be set differently. That is, according to theabove-mentioned conditions, it is possible to restrict the current blockfrom using at least one of a diagonal scan, a horizontal scan, or avertical scan.

For example, if the current block has a non-square shape, a scanningorder available for the current block may be determined according to awidth and height ratio. For example, if the current block is a codingblock or a transform block having a shape whose height is longer thanthe width (e.g., N×2N or N×4N), at least one of a diagonal scan or ahorizontal scan can be selected. On the other hand, if the current blockis a coding block or a transform block having a shape whose width islonger than the height (e.g., 2N×N or 4N×N), at least one of a diagonalscan or a vertical scan can be selected.

The current block may be divided into predetermined sub-blocks, andscanning of transform coefficients may be performed in a unit of asub-block. For example, scanning of transform coefficients may beperformed on a transform coefficient basic block unit including apredetermined number of pixels.

Even when the current block has a non-square shape, the current blockmay be divided into sub-blocks, and scanning can be performed in a unitof a sub-block. At this time, a size of the sub-block may have a fixedvalue or may have a value varied based on at least one of a size or ashape of the current block (e.g., a coding block or a transform block).

For example, as described above with reference to the transformcoefficient basic block, the sub-block may include a fixed number ofpixels (for example, 16). Here, a size of the sub-block may be set 4×4,2×8, or 8×2, or the like depending on a shape of a coding block or atransform block.

A partition type of the sub-block may be the same as the coding block orthe transform block. Alternatively, the partition type of the sub-blockmay be determined independently of a partition type of the coding block.The sub-block may has a square shape or a non-square shape, depending onthe partition type.

A scanning order of each sub-block may be determined according to ascanning order of the current block. For example, FIG. 20 is a diagramillustrating a scanning order between sub-blocks according to a scanningorder of a current block.

In the example shown in FIG. 20, when the scanning order of the currentblock is a diagonal scan, at least one of a scanning order betweensub-blocks or a scanning order in a sub-block may follow the diagonalscan. On the other hand, when the scanning order of the current block isa horizontal scan, at least one of a scanning order between sub-blocksor a scanning order of transform coefficients in a sub-block may followthe horizontal scan. Alternatively, if the scanning order of the currentblock is a vertical scan, at least one of a scanning order betweensub-blocks or a scanning order in a sub-block may follows a verticalscan.

Alternatively, a scanning order of each sub-block may be adaptively setaccording to a shape or a size of a coding block or a current block.That is, the scanning order of the transform coefficient basic blocksmay be set differently according to the size or the shape of the currentblock.

FIG. 21 is a diagram illustrating a scanning order of a transformcoefficient basic block according to a shape of a current block. In FIG.21, the numbers marked on each sub-block indicate a scanning order.

If a current block is a coding block or a transform block having a shapein which a height is longer than a width, it is possible to sequentiallyscan the transform coefficient basic blocks using the diagonal scan asin the example shown in FIG. 21.

On the other hand, if a current block is a coding block or a transformblock having a shape in which a width is longer than a height, it ispossible to sequentially scan the transform coefficient basic blocksusing the horizontal scan as in the example shown in FIG. 21.

That is, according to a shape of the current block, scanning orders ofthe transform coefficient basic blocks may be set to be different.

A relationship between a shape of the current block and a scanning orderof the transform coefficient basic blocks, which is defined in FIG. 21,is merely an example of the present invention, and the present inventionis not limited thereto. For example, if a current block is a codingblock or a transform block having a shape in which a height is longerthan a width, it is also possible to sequentially scan transformcoefficient basic blocks using the vertical scan, unlike the exampleshown in FIG. 21.

According to an embodiment of the present invention, scanning may beperformed in a unit of a block group (or in a unit of a block) or ascanning order may be determined in a unit of the block group. Here, theblock group may represent a block unit in which scanning is performed,or may represent a group of transform blocks that share the samescanning type. The block group may include at least one transform block.Alternatively, a plurality of non-square transform blocks constituting asquare shaped block may be defined as the block group.

For example, if a size or a range of the block group is determined, theblock group may be divided into units for scanning, and then thescanning for the block group may be performed. Here, scanning units mayhave the same sizes or the same shapes as transform blocks included inthe block group. Alternatively, at least one of sizes or shapes of thescanning units may be different from the transform blocks included inthe block group. For example, a scanning unit is limited to a squareshape, while the block group includes a transform block of a non-squareshape.

For example, if a size or a range of the block group is determined, ascanning order for the block group may be determined, and the determinedscanning order may be applied to all transform blocks in the blockgroup.

The block group may have a square shape or a non-square shape. Inaddition, the block group may include at least one non-square shapedtransform block or at least one square shaped transform block.

A size of the block group may have a fixed value or may have a valuedetermined variably. For example, a size of the block group may has afixed value such as 64×64, 32×32, or 16×16, or may be determined basedon information on the size of the block group transmitted through thebitstream.

If the residual coefficient of the current block is obtained, an inversequantization may be performed on the residual coefficient of the currentblock 51650.

It is possible to determine whether to skip an inverse transform on thedequantized residual coefficient of the current block 51660.Specifically, the decoder may determine whether to skip the inversetransform on at least one of a horizontal direction or a verticaldirection of the current block. When it is determined to apply theinverse transform on at least one of the horizontal direction or thevertical direction of the current block, a residual sample of thecurrent block may be obtained by inverse transforming the dequantizedresidual coefficient of the current block 51670. Here, the inversetransform can be performed using at least one of DCT, DST, and KLT.

When the inverse transform is skipped in both the horizontal directionand the vertical direction of the current block, inverse transform isnot performed in the horizontal direction and the vertical direction ofthe current block. In this case, the residual sample of the currentblock may be obtained by scaling the dequantized residual coefficientwith a predetermined value S1680.

Skipping the inverse transform on the horizontal direction means thatthe inverse transform is not performed on the horizontal direction butthe inverse transform is performed on the vertical direction. At thistime, scaling may be performed in the horizontal direction.

Skipping the inverse transform on the vertical direction means that theinverse transform is not performed on the vertical direction but theinverse transform is performed on the horizontal direction. At thistime, scaling may be performed in the vertical direction.

It may be determined whether or not an inverse transform skip techniquemay be used for the current block depending on a partition type of thecurrent block. For example, if the current block is generated through abinary tree-based partitioning, the inverse transform skip scheme may berestricted for the current block. Accordingly, when the current block isgenerated through the binary tree-based partitioning, the residualsample of the current block may be obtained by inverse transforming thecurrent block. In addition, when the current block is generated throughbinary tree-based partitioning, encoding/decoding of informationindicating whether or not the inverse transform is skipped (e.g.,transform_skip_flag) may be omitted.

Alternatively, when the current block is generated through binarytree-based partitioning, it is possible to limit the inverse transformskip scheme to at least one of the horizontal direction or the verticaldirection. Here, the direction in which the inverse transform skipscheme is limited may be determined based on information decoded fromthe bitstream, or may be adaptively determined based on at least one ofa size of the current block, a shape of the current block, or an intraprediction mode of the current block.

For example, when the current block is a non-square block having a widthgreater than a height, the inverse transform skip scheme may be allowedonly in the vertical direction and restricted in the horizontaldirection. That is, when the current block is 2N×N, the inversetransform is performed in the horizontal direction of the current block,and the inverse transform may be selectively performed in the verticaldirection.

On the other hand, when the current block is a non-square block having aheight greater than a width, the inverse transform skip scheme may beallowed only in the horizontal direction and restricted in the verticaldirection. That is, when the current block is N×2N, the inversetransform is performed in the vertical direction of the current block,and the inverse transform may be selectively performed in the horizontaldirection.

In contrast to the above example, when the current block is a non-squareblock having a width greater than a height, the inverse transform skipscheme may be allowed only in the horizontal direction, and when thecurrent block is a non-square block having a height greater than awidth, the inverse transform skip scheme may be allowed only in thevertical direction.

Information indicating whether or not to skip the inverse transform withrespect to the horizontal direction or information indicating whether toskip the inverse transformation with respect to the vertical directionmay be signaled through a bitstream. For example, the informationindicating whether or not to skip the inverse transform on thehorizontal direction is a 1-bit flag, ‘hor_transform_skip_flag’, andinformation indicating whether to skip the inverse transform on thevertical direction is a 1-bit flag, ‘ver_transform_skip_flag’. Theencoder may encode at least one of ‘hor_transform_skip_flag’ or‘ver_transform_skip_flag’ according to the shape of the current block.Further, the decoder may determine whether or not the inverse transformon the horizontal direction or on the vertical direction is skipped byusing at least one of “hor_transform_skip_flag” or“ver_transform_skip_flag”.

It may be set to skip the inverse transform for any one direction of thecurrent block depending on a partition type of the current block. Forexample, if the current block is generated through a binary tree-basedpartitioning, the inverse transform on the horizontal direction orvertical direction may be skipped. That is, if the current block isgenerated by binary tree-based partitioning, it may be determined thatthe inverse transform for the current block is skipped on at least oneof a horizontal direction or a vertical direction withoutencoding/decoding information (e.g., transform_skip_flag,hor_transform_skip_flag, ver_transform_skip_flag) indicating whether ornot the inverse transform of the current block is skipped.

Encoding/decoding of residual signal may be performed in a unit of ablock having a specific shape. Here, the specific shape may mean asquare shaped block, or a non-square shaped block whose a ratio betweena width and a height is equal to or greater than a predetermined value.For convenience of explanation, it is assumed in the embodimentdescribed below that encoding/decoding of the residual signal isperformed in a unit of a block having a square shape.

If the current block (for example, a coding block or a transform block)which is a target for encoding/decoding residual signal has a non-squareshape, the current block of the non-square shape is divided or convertedinto a block of a square shape, and a quantization, a transform orencoding/decoding of residual signal (e.g., residual coefficients) maybe performed on the block of the square shape.

For example, a transform type may be determined in a unit of a block ofa square shape. Here, the transform type may mean at least one of atransform scheme (e.g., DCT or DST) or a transform mode (e.g., 2Dtransform mode, 1D transform (vertical/horizontal) mode or anon-transform mode). To do this, it is possible to divide the currentblock of the non-square shape into sub-blocks of the square shape, anddetermine the transform type in a unit of a sub-block.

FIG. 22 is a diagram illustrating an example of dividing a current blockof a non-square shape into sub-blocks of a square shape.

If the current block is a block of a non-square shape, the current blockmay be divided into a plurality of sub-blocks having a square shape asin the example shown in FIG. 22. In FIG. 22, it is illustrated that ablock of N×2N type is divided into N×N type sub-blocks.

A transform type may be determined for each divided sub-block. That is,a first sub-transform block corresponding to an upper part of thecurrent block and a second sub-transform block corresponding to a lowerpart of the current block may be independently transformed such as DCTor DST.

Alternatively, a first transform may be performed on each of a pluralityof sub-blocks included in the current block, and then a second transformmay be performed on a unit including the plurality of sub-blocks. Here,the first transform and the second transform may be different from eachother in at least one of a transform mode, a transform scheme, or atarget area of a transform.

As another example, it is possible to generate a block of a square shapeby merging the current block of a non-square shape with a neighboringblock, and to determine a transform type on the generated block of thesquare shape. At this time, the current block may be merged with atleast one neighboring block adjacent to a left, a right, a top, or abottom of the current block. The plurality of blocks included in themerged block may have the same transform type.

Alternatively, it is also possible to perform a first transform on themerged block of the square shape, and then to perform a second transformon each of the plurality of blocks included in the merged block of thesquare shape.

The current block of s non-square shape may be converted into a squareshape, and a transform may be performed on the converted current block.

For example, FIGS. 23 to 26 are diagrams illustrating an example ofconverting a block of a non-square shape into a block of a square shape.

When the current block has a non-square shape, the current block may beconverted into a square shape by dividing the current block intosub-blocks based on a predetermined size or a predetermined shape, andrearranging the divided sub-blocks in a predetermined order. Here, thepredetermined order may include at least one of a Z scan, a verticalscan, or a horizontal scan, or a reverse order of the Z scan, thevertical scan, or the horizontal scan. The scan order used to convertthe current block may be determined based on at least one of a size, ashape, an encoding mode (e.g., intra mode or inter mode) or an intraprediction mode (e.g., direction or angle of intra prediction mode) ofthe current block. Alternatively, it is possible to use a predefinedorder in the encoder/decoder, or to signal information for specifying anorder of arrangement of sub-blocks through the bitstream.

FIGS. 23 and 24 are drawings illustrating an example of converting ablock of N×4N type into a block of a square shape.

In order to convert the current block into a square block, a block ofN×4N type may be divided into four sub-blocks of the same shape.Thereafter, the divided sub-blocks are arranged in a line in ahorizontal direction, thereby generating a square-shaped block.

It is illustrated in FIG. 23 that a block of 2N×2N size is generated byarranging sub-blocks (3, 4) located at a lower part of the current blockto a right of sub-blocks (1, 2) located at an upper part of the currentblock (Z scan order or horizontal scan order being used). It isillustrated in FIG. 24 that a block of 2N×2N size is generated byarranging sub-blocks in a horizontal direction (that is, arranging thesub-blocks in the order of 1, 3, 2, 4) according to a vertical scanningorder.

FIGS. 25 and 26 are drawings illustrating an example of converting ablock of 4N×N type into a block of a square shape.

In order to convert a current block into a square block, a block of 4N×Nshape may be divided into four sub-blocks of the same shape.Subsequently, the divided sub-blocks are arranged in a line in avertical direction, thereby generating a square-shaped block.

It is illustrated in FIG. 25 that a block of 2N×2N size is generated byarranging sub-blocks (3, 4) located at a right side of the current blockto a bottom of sub-blocks (1, 2) located at a left side of the currentblock (Z scan order or vertical scan order being used). It isillustrated in FIG. 26 that a block of 2N×2N is generated by arrangingsub-blocks in a vertical direction (that is, arranging the sub-blocks inthe order of 1, 3, 2, 4) according to a horizontal scanning order.

It is illustrated in FIGS. 23 to 26 that the current block is dividedinto four sub-blocks in order to convert the current block into a squareshape. However, it is also possible to divide the current block into alarger number or a fewer number of sub-blocks to convert the currentblock into a block of the square shape.

After converting the current block into a block of a square shape, it ispossible to perform DCT or DST transform on the converted block.Alternatively, it is also possible to convert the current block into ablock of a square shape, and then encode residual coefficients byapplying a transform skip to the converted block.

As another example, a quantization or a transform may be performed on ablock of a non-square shape. However, transform coefficients for theblock of the non-square shape in which the quantization or thetransformation is completed may be encoded in a unit of a block of asquare shape. That is, encoding/decoding of the transform coefficientsmay performed on a block of a square shape, while the transform or thequantization is performed on a block of a non-square shape.

Although the above-described embodiments have been described on thebasis of a series of steps or flowcharts, they do not limit thetime-series order of the invention, and may be performed simultaneouslyor in different orders as necessary. Further, each of the components(for example, units, modules, etc.) constituting the block diagram inthe above-described embodiments may be implemented by a hardware deviceor software, and a plurality of components. Or a plurality of componentsmay be combined and implemented by a single hardware device or software.The above-described embodiments may be implemented in the form ofprogram instructions that may be executed through various computercomponents and recorded in a computer-readable recording medium. Thecomputer-readable recording medium may include one of or combination ofprogram commands, data files, data structures, and the like. Examples ofcomputer-readable media include magnetic media such as hard disks,floppy disks and magnetic tape, optical recording media such as CD-ROMsand DVDs, magneto-optical media such as floptical disks, media, andhardware devices specifically configured to store and execute programinstructions such as ROM, RAM, flash memory, and the like. The hardwaredevice may be configured to operate as one or more software modules forperforming the process according to the present invention, and viceversa.

INDUSTRIAL APPLICABILITY

The present invention may be applied to electronic devices which is ableto encode/decode a video.

1-15. (canceled)
 16. A method of decoding a video, the methodcomprising: decoding, from a bitstream, an enabled flag indicatingwhether it is allowed to divide a block into two partitions or not; whenthe enabled flag indicates that the division is allowed, determining,based on a first flag of 1-bit, whether to divide a current coding blockinto two partitions or not; when it is determined to divide the currentcoding block, determining, based on a second flag of 1-bit, whether todivide the current coding block symmetrically or asymmetrically; anddetermining, based on a third flag of 1-bit, whether to divide thecurrent coding block in a horizontal direction or in a verticaldirection, wherein when it is determined to divide the current codingblock asymmetrically, the current coding block is partitioned into afirst partition that has a ¾ size of the current coding block and asecond partition that has a ¼ size of the current coding block, andwherein locations of the first partition and the second partition in thecurrent coding block is determined based on a fourth flag of 1-bit. 17.The method of claim 16, wherein when it is determined to divide thecurrent coding block in the horizontal direction, based on the fourthflag, it is determined whether the first partition is located at anupper side or a bottom side of the current coding block, and whereinwhen it is determined to divide the current coding block in the verticaldirection, based on the fourth flag, it is determined whether the firstpartition is located at a left side or a right side of the currentcoding block.
 18. The method of claim 16, wherein a number of asymmetricpartition types available for the current coding block is variedaccording to a size of the current block.
 19. The method of claim 16,wherein when it is determined to divide the current coding block intothe two partitions, decoding of a transform skip flag which specifyingwhether an inverse-transform is skipped or not is omitted.
 20. Themethod of claim 18, wherein when decoding of the transform skip flag isomitted, skipping the inverse-transform for the first partition or thesecond partition is not allowed.
 21. A method of encoding a video, themethod comprising: encoding a first flag of 1-bit specifying whether acurrent coding block is divided into two partitions or not; when thecurrent coding block is divided into two partitions, encoding a secondflag of 1-bit specifying whether the current coding block is dividedsymmetrically or asymmetrically; encoding a third flag of 1-bitspecifying whether the current coding block is divided in a horizontaldirection or in a vertical direction; and encoding an enabled flagindicating whether it is allowed to divide a block into two partitionsor not, wherein when the current coding block is divided asymmetrically,the current coding block is partitioned into a first partition that hasa ¾ size of the current coding block and a second partition that has a ¼size of the current coding block, and wherein a fourth flag of 1-bitwhich is used to determine locations of the first partition and thesecond partition in the current coding block is further encoded.
 22. Themethod of claim 21, wherein when the current coding block is divided inthe horizontal direction, the fourth flag is used to determine whetherthe first partition is located at an upper side or a bottom side of thecurrent coding block, and wherein when the current coding block isdivided in the vertical direction, the fourth flag is used to determinewhether the first partition is located at a left side or a right side ofthe current coding block.
 23. The method of claim 21, wherein a numberof asymmetric partition types available for the current coding block isvaried according to a size of the current block.
 24. The method of claim21, wherein when the current coding block is divided into the twopartitions, encoding of a transform skip flag which specifying whether atransform is skipped or not is omitted.
 25. The method of claim 24,wherein when encoding of the transform skip flag is omitted, skippingthe transform for the first partition or the second partition is notallowed.
 26. A non-transitory computer-readable medium for storing dataassociated with a video signal, comprising: a data stream stored in thenon-transitory computer-readable medium, the data stream being encodedby an encoding method which comprising: encoding a first flag of 1-bitspecifying whether a current coding block is divided into two partitionsor not; when the current coding block is divided into two partitions,encoding a second flag of 1-bit specifying whether the current codingblock is divided symmetrically or asymmetrically; encoding a third flagof 1-bit specifying whether the current coding block is divided in ahorizontal direction or in a vertical direction; and encoding an enabledflag indicating whether it is allowed to divide a block into twopartitions or not, wherein when the current coding block is dividedasymmetrically, the current coding block is partitioned into a firstpartition that has a ¾ size of the current coding block and a secondpartition that has a ¼ size of the current coding block, and wherein afourth flag of 1-bit which is used to determine locations of the firstpartition and the second partition in the current coding block isfurther encoded.